home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / patches / thinkc.sit / Think ƒ / IMPORTANT - READ THIS! next >
Encoding:
Text File  |  1989-03-16  |  5.7 KB  |  178 lines  |  [TEXT/KAHL]

  1.  
  2. Change in Exit Handling
  3. 3/16/89
  4.  
  5. The 3.02 compiler is incompatible with versions of the C libraries earlier
  6. than 3.01p4.  If you are using older libraries, it is IMPERATIVE that you
  7. apply the 3.02 library update when you apply the 3.02 patch.
  8.  
  9. (If you have already upgraded to the 3.01p4 libraries, there is no need to
  10. upgrade further to 3.02, as there are no substantive changes.  However, if
  11. you prefer to keep current, the differences are summarized at the end of
  12. this memo.)
  13.  
  14. Also, this memo contains critical information concerning the behavior of
  15. your application when it exits.  This is information which you MUST KNOW
  16. if:
  17.  
  18.     (1a) You call the standard library function "onexit", or you use
  19.          stdio, the profiler, or "signal" (each of which calls "onexit").
  20.  
  21.                                 -or-
  22.  
  23.     (1b) You build applications with the "Separate STRS" option set.
  24.          (This option is frequently set in projects which originated
  25.          prior to THINK C 3.0.)
  26.     
  27.                                 -and-
  28.  
  29.     (2)  Your application can exit by calling "Launch" (or "_Launch").
  30.          (For example, your application may implement a "Transfer"
  31.          menu.)
  32.  
  33. If you don't use "Launch", or you don't use "onexit" or "Separate STRS",
  34. then you can get away without reading the rest of this.  But please be
  35. sure to update your libraries no matter what!
  36.  
  37.  
  38. BACKGROUND
  39. ----------
  40.  
  41. The manner in which THINK C applications clean up when they exit changed
  42. as of version 3.01p4.  When using this version (or later), it is
  43. critical that you avoid using earlier versions of the standard libraries,
  44. as the implementation of "onexit" has changed in an incompatible way.
  45.  
  46. In addition, it can no longer be guaranteed that your application will
  47. be able to clean up if it exits with a "Launch".  This may be an issue
  48. if you are relying on "onexit" to schedule clean-up.  Even if you're not
  49. using "onexit", the runtime system for applications built with "Separate
  50. STRS" has clean-up of its own to perform at exit.
  51.  
  52. Previously, the runtime system built into every THINK C application was
  53. able to arrange for clean-up no matter how the application might exit.
  54. Unfortunately, the method used to assure this resulted in applications
  55. which were not "32-bit clean".
  56.  
  57. The new method is 32-bit clean, but can't catch the case where the
  58. application exits with a "Launch".  (Actually, even this case is caught
  59. if the application is running under MultiFinder -- though this can't be
  60. guaranteed for future versions of MultiFinder.)
  61.  
  62.  
  63. WAYS OF EXITING
  64. ---------------
  65.  
  66. Let's define some terms:
  67.  
  68.     "normal exit"
  69.     
  70.         If your application exits by calling the "exit" function, or
  71.         by returning from "main", this is considered a normal exit.
  72.     
  73.     "abnormal exit"
  74.     
  75.         If your application exits by calling "ExitToShell", this is
  76.         considered an abnormal exit.  Calling "abort" is covered under
  77.         this definition, as is terminating execution under the control
  78.         of a debugger.  (Under the CURRENT implementation of MultiFinder,
  79.         all exits are either normal or abnormal -- even "SysError" ends
  80.         up calling "ExitToShell"!  However, this may not be so in the
  81.         future.)
  82.     
  83.     "unsafe exit"
  84.     
  85.         If your application exits by calling "Launch", or in any other
  86.         manner not covered above, this is considered an unsafe exit.
  87.  
  88.  
  89. ONEXIT AND _ONEXIT
  90. ------------------
  91.  
  92. Routines registered with "onexit" will now be called only on normal exits.
  93. Previously, they were called on any form of exit.
  94.  
  95. A new routine, "_onexit", is now available.  Routines registered with
  96. "_onexit" will be called on abnormal as well as normal exits.
  97.  
  98. To summarize:
  99.  
  100.     (1) On a normal exit, routines registered with "onexit" or
  101.         "_onexit" will be called.
  102.     
  103.     (2) On an abnormal exit, routines registered with "_onexit"
  104.         will be called.  Routines registered with "onexit" will
  105.         NOT be called.
  106.  
  107. In both of these cases, the runtime support for "Separate STRS" will be
  108. given a chance to clean up.  (This happens even if you never register any
  109. clean-up routines of your own.)
  110.  
  111.  
  112. DEALING WITH UNSAFE EXITS
  113. -------------------------
  114.  
  115. If an unsafe exit is taken, no clean-up routines will be called.  If you
  116. have registered essential clean-up routines (e.g. removing trap intercepts
  117. or other low-memory vectors), or if your application is built using
  118. "Separate STRS", this could be disastrous.
  119.  
  120. To deal with this, a new routine, "_exiting", is now available.  This
  121. function performs all appropriate clean-up, but doesn't actually exit.
  122. It should be called before initiating an unsafe exit, e.g. before calling
  123. "Launch".
  124.  
  125. "_exiting" takes an argument indicating whether the clean-up should be
  126. that associated with a normal or an abnormal exit.  A non-zero argument
  127. indicates a normal exit.
  128.  
  129. If your application never calls "onexit" or "_onexit" (and doesn't use
  130. stdio, the profiler, or "signal", which do), AND if your application is
  131. not built with "Separate STRS", then you needn't bother with "_exiting".
  132.  
  133. The "exec" series of standard library functions call "_exiting(1)".
  134.  
  135.  
  136. CHANGES FROM 3.01p4 to 3.02
  137. ---------------------------
  138.  
  139. There are no substantive changes in this release.  However, if you'd like
  140. to update your libraries, here's how:
  141.  
  142.     (1)    Remove the "Config Headers" folder completely.  It is no
  143.         longer used.
  144.         
  145.     (2)    Remove the line
  146.     
  147.             #include "config.h"
  148.         
  149.         from the following files:
  150.         
  151.             printf-2-w.c
  152.             printf-3.c
  153.             scanf2.c
  154.             unixatof.c
  155.         
  156.     (3)    If desired, insert the line
  157.     
  158.             #define _HALFWINDOW_
  159.         
  160.         in printf-2-w.c where the #include "config.h" used to be.
  161.         (This #define causes the console window to be half-height
  162.         under MultiFinder, to make room for the debugger's windows.)
  163.         
  164.     (4)    In stdver.c, change the version number from 3.01p4 to 3.02.
  165.     
  166.     (5) Rebuild the affected projects, which are:
  167.     
  168.             sprintf
  169.             sprintf881
  170.             stdio
  171.             stdio881
  172.             unix
  173.             unix881
  174.  
  175.         To rebuild each project, open it, bring up the "Make╔"
  176.         dialog box, uncheck "Quick Scan", and click "Use Disk".
  177.         Finally, click "Make".
  178.